package com.ruoyi.pg.answerSheet.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.pg.answerSheet.domain.PgAnswer;
import com.ruoyi.pg.answerSheet.vo.PgAnswerVo;

import java.math.BigDecimal;
import java.util.List;

/**
 * 答卷详情Service接口
 *
 * @author Ming
 * @date 2025-08-22
 */
public interface IPgAnswerService extends IService<PgAnswer> {

    /**
     * 分页查询
     *
     * @param entity
     * @return
     */
    TableDataInfo<PgAnswerVo> queryList(PgAnswerVo entity);

    /**
     * 查询全部
     *
     * @param entity
     * @return
     */
    List<PgAnswerVo> queryAll(PgAnswerVo entity);

    /**
     * 根据ID查询
     *
     * @param id
     * @return
     */
    PgAnswerVo queryById(Long id);

    /**
     * 查询评估完成度
     *
     * @param assId
     * @return
     */
    Integer completion(Long assId);

    /**
     * 根据评估id和问卷题目id查询
     *
     * @param assId
     * @param questionId
     * @return
     */
    PgAnswer queryByIds(Long assId, Long questionId);

    /**
     * 没有则添加，有则修改
     *
     * @param entity
     * @return
     */
    int addOrEdit(PgAnswerVo entity);

    /**
     * 批量插入
     */
    void saveBatch(PgAnswerVo entity);

    /**
     * 计算分数
     *
     * @param entity
     */
    void calculateScore(PgAnswerVo entity);

    /**
     * 生成评估编号
     */
    String generateString(Long projectCode, Long questionId);

    /**
     * 查询评估分数
     *
     * @param assId
     * @return
     */
    PgAnswerVo queryScore(Long assId);

    /**
     * 判断问卷分组是否完成
     *
     * @param surveyId
     * @param assId
     * @return
     */
    Boolean ifCompleteBySurveyId(Long surveyId, Long assId);
}
